package com.ms.oschina.viewholder;

import android.view.View;
import android.widget.TextView;

import com.ms.oschina.R;
import com.ms.oschina.base.BaseViewHolder;
import com.ms.oschina.bean.News;
import com.ms.oschina.util.LogUtils;
import com.ms.oschina.util.StringUtils;
import com.ms.oschina.util.UiUtils;

public class SynthesizeViewHolder extends BaseViewHolder<News> {
	private TextView tvSynthesizeTitle;
	private TextView tvSynthesizeDetail;
	private TextView tvSynthesizePresenter;
	private TextView tvSynthesizePublishTime;
	private TextView tvSynthesizeCommentCount;

	private void findViews(View view) {
		tvSynthesizeTitle = (TextView) view
				.findViewById(R.id.tv_synthesize_title);
		tvSynthesizeDetail = (TextView) view
				.findViewById(R.id.tv_synthesize_detail);
		tvSynthesizePresenter = (TextView) view
				.findViewById(R.id.iv_event_title);
		tvSynthesizePublishTime = (TextView) view
				.findViewById(R.id.tv_synthesize_publishTime);
		tvSynthesizeCommentCount = (TextView) view
				.findViewById(R.id.tv_synthesize_commentCount);
	}

	@Override
	public View initView() {
		View view = UiUtils.inflate(R.layout.item_synthesize_datas);
		findViews(view);
		return view; 
	}

	@Override
	public void setData(int position, News data) {
		tvSynthesizeCommentCount.setText("" + data.getCommentCount());
		tvSynthesizeTitle.setText(data.getTitle());
		tvSynthesizePublishTime.setText(StringUtils.friendly_time(data.getPubDate()));
		tvSynthesizeDetail.setText(data.getBody());
		tvSynthesizePresenter.setText(data.getAuthor());
	}

}
